package com.sunsy.authserver.wrapper;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sunsy.authserver.beans.dto.UserAppRelationDTO;
import com.sunsy.authserver.beans.po.UserAppRelation;
import com.sunsy.authserver.beans.vo.UserAppRelationVO;

/**
 * (UserAppRelation)表包装类
 *
 * @author makejava
 * @since 2021-07-20 14:40:45
 */
public class UserAppRelationWrapper extends AbstractWrapper<UserAppRelation, UserAppRelationVO, UserAppRelationDTO>{

  public static UserAppRelationWrapper build() {
    return new UserAppRelationWrapper();
  }

  /**
   * dto转queryWrapper
   *
   * @param dto 交互数据
   * @return 查询Wrapper
   */
  @Override
  public QueryWrapper<UserAppRelation> dto2QWrapper(UserAppRelationDTO dto) {
    UserAppRelation po = dto2PO(dto);
    return new QueryWrapper<>(po);
  }

  /**
   * dto转po
   *
   * @param dto 交互数据
   * @return UserAppRelation 实体对象
   */
  @Override
  public UserAppRelation dto2PO(UserAppRelationDTO dto) {
    return BeanUtil.copyProperties(dto, UserAppRelation.class);
  }

  /**
   * po转vo
   *
   * @param po 实体对象
   * @return UserAppRelation 实体展示对象
   */
  @Override
  public UserAppRelationVO po2VO(UserAppRelation po) {
    return BeanUtil.copyProperties(po, UserAppRelationVO.class);
  }

}